// 付款
function payment(orderId) {
    $.ajax({
            url: "${ctx}/edit/status",
            type: 'post',
            data: {
                'orderId': orderId,
                'status': '3'
            },
            dataType: 'json',
            success: function (response) {
                console.log(response);
                if (response.success) {
                    alert(response.message);
                    window.location.reload();
                } else {
                    alert(response.message);
                }
            }
        }
    );
}

// 取消订单
function cancelOrder(orderId) {
    $.ajax({
            url: "${ctx}/edit/status",
            type: 'post',
            data: {
                'orderId': orderId,
                'status': '2'
            },
            dataType: 'json',
            success: function (response) {
                console.log(response);
                if (response.success) {
                    alert(response.message);
                    window.location.reload();
                } else {
                    alert(response.message);
                }
            }
        }
    );
}

// 确认收货
function receipt(orderId) {
    $.ajax({
            url: "${ctx}/edit/status",
            type: 'post',
            data: {
                'orderId': orderId,
                'status': '6'
            },
            dataType: 'json',
            success: function (response) {
                console.log(response);
                if (response.success) {
                    alert(response.message);
                    window.location.reload();
                } else {
                    alert(response.message);
                }
            }
        }
    );
}

// 默认好评
function commentary(orderId) {
    $.ajax({
            url: "${ctx}/edit/status",
            type: 'post',
            data: {
                'orderId': orderId,
                'buyerMessage': '默认好评',
                'status': '7'
            },
            dataType: 'json',
            success: function (response) {
                console.log(response);
                if (response.success) {
                    alert(response.message);
                    window.location.reload();
                } else {
                    alert(response.message);
                }
            }
        }
    );
}